<?php

require_once 'KgridList.php';

//$this->_KgridListing =  new KgridList();
$KgridListing =  new KgridList();



$strAction = $_REQUEST["action"];           //get action from another web page

$strPK_ID = $_REQUEST["num"]; 

$intRowIDGet = $_REQUEST["rowid"]; 
$intPageIDGet = $_REQUEST["pageid"];  
$intSkipGet = $_REQUEST["skip"];  

//get Sorted by field and PageSize, that are passed as well
$strSortField = $_REQUEST["sortby"];  
$strPageSizeGet = $_REQUEST["pagesize"];  

  if ($strPageSizeGet == ""
            || strlen($strPageSizeGet) == 0)
 {
                  $intPageSizeGet = 1;     //so as not to divide by 0
 }
 else
 {
                  $intPageSizeGet = $strPageSizeGet;
 }


//echo $strPK_ID;


//echo $strAction;


//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//Next Sort and Search fields are for if using LIST in conjunction (Do not need for Standalone Update form)
//----------------------------------------------------------------------------------------------------------
                $strarraysearch = $_REQUEST["arraysearch"];  
                //$strmachsearch = $_REQUEST["machsearch"]; 
                $strmachsearch = "";





if ($strAction == "chkpageTrue")
{
 UpdateDBaseTrue($strPK_ID);
}

if ($strAction == "chkpageFalse")
{
 UpdateDBaseFalse($strPK_ID);
}



 //$strReinitialise = " False ";

 //$ActionPage = "GetCurrentPage";

 //$KgridListing->ajaxkgridlist($ActionPage, $strarraysearch, $intPageIDGet, $strSortField, $intSkipGet, $intRowIDGet, $strPK_ID, $strReinitialise);







    function UpdateDBaseTrue($strPK_ID)
    {

        $dsn2="SQLSERVER2005";
        $username2="sa";
        $password2="and";
   
        $odbc = odbc_connect($dsn2,$username2,$password2);

        $update = "UPDATE ARRAYS2 SET COMPLETE_FLAG ='True'  ";
        $update = $update . "WHERE PK_ID = " . $strPK_ID . "";

        //echo $update;
		
        odbc_exec($odbc,$update);

        odbc_close($odbc);

   }



    function UpdateDBaseFalse($strPK_ID)
    {

        $dsn2="SQLSERVER2005";
        $username2="sa";
        $password2="and";
      
        $odbc = odbc_connect($dsn2,$username2,$password2);

        $update = "UPDATE ARRAYS2 SET COMPLETE_FLAG ='False'  ";
        $update = $update . "WHERE PK_ID = " . $strPK_ID . "";

        //echo $update;
		
        odbc_exec($odbc,$update);

        odbc_close($odbc);

   }






?>
